﻿using System;
using System.IO;
using System.Net;

class HttpWebRequestDemo
{
    static void Main(string[] args)
    {
        string url = "http://www.jobspot.bg/";
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        WebHeaderCollection headers = response.Headers;
        Console.WriteLine("HTTP headers:\n{0}", headers);

        string contentType = response.ContentType;
        Console.WriteLine("Content-Type: {0}\n", contentType);

        Console.WriteLine("Response body:\n");
        Stream stream = response.GetResponseStream();
        using (stream)
        {
            StreamReader reader = new StreamReader(stream, System.Text.Encoding.GetEncoding(1251));
            string responseBody = reader.ReadToEnd();
            Console.WriteLine(responseBody);
        }
    }
}